import { callService } from "./api";
import type {
  MenuCreatePayload,
  MenuListResponse,
  MenuRemoveResponse,
  MenuSavePayload,
  MenuSaveResponse,
} from "../types/dto";

export function fetchMenu() {
  return callService<MenuListResponse>("menuList");
}

export function updateMenu(payload: MenuSavePayload) {
  return callService<MenuSaveResponse>("menuUpdate", payload as unknown as Record<string, unknown>);
}

export function toggleDishStatus(menuId: string, isActive: boolean) {
  return callService<MenuSaveResponse>("menuToggle", { menuId, isActive });
}

export function createMenu(payload: MenuCreatePayload) {
  return callService<MenuSaveResponse>("menuCreate", payload as unknown as Record<string, unknown>);
}

export function removeMenu(menuId: string) {
  return callService<MenuRemoveResponse>("menuRemove", { menuId });
}
